//
//  YXChangeVoiceUtilities.h
//  ChangeVoiceDemo
//
//  Created by yixia on 14-3-27.
//  Copyright (c) 2014年 yixia. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>


typedef enum : int {
    YXChangeVoiceUtilityStatusUnknown,
    YXChangeVoiceUtilityStatusProcessing,
    YXChangeVoiceUtilityStatusComplete,
    YXChangeVoiceUtilityStatusFailed,
    YXChangeVoiceUtilityStatusCanceled
} YXChangeVoiceUtilityStatus;


@class YXChangeVoiceUtilities;

@protocol YXChangeVoiceUtilitiesDelegate <NSObject>

@optional

- (void)util:(YXChangeVoiceUtilities *)util withProgress:(CGFloat)progress status:(YXChangeVoiceUtilityStatus)status;

@end


@interface YXChangeVoiceUtilities : NSObject

@property (nonatomic ,assign) YXChangeVoiceUtilityStatus status;
@property (nonatomic ,assign) id<YXChangeVoiceUtilitiesDelegate> delegate;
@property (nonatomic ,assign) CGFloat progress;
@property (nonatomic, copy  ) dispatch_block_t interuptBlock;

#pragma mark - 各方法单独使用
//将视频中的音轨导出到wav文件
-(void)exportAssetAudioToWav:(NSString *)inputPath outputPath:(NSString*)outputPath completeHanlder:(void (^)(NSString *))completeHandler;

//将音频wav文件变声处理
//pitchSemiTone ~12-12 == -1.0 ~ +1.0
- (void)processAudioWithWAVFile:(NSString *)wavFilePath newWavPath:(NSString*)newWavPath pitchSemiTone:(CGFloat)pitchSemiTone completeHanlder:(void (^)(NSString *))completeHandler;

//将变声后的wav文件与视频结合
-(void)changeOriginalVideo:(NSString*)originalPath withNewVoice:(NSString*)newVoicePath toNewVideo:(NSString*)outputPath completeHanlder:(void (^)(NSString *))completeHandler;

- (void)exportAssetAudioToWavWithRate:(CGFloat)rate inputPath:(NSString *)inputPath outputPath:(NSString*)outputPath completeHanlder:(void (^)(NSString *))completeHandler;
- (void)exportToWavWithAsset:(AVAsset*)asset outputPath:(NSString*)outputPath completeHanlder:(void (^)(NSString *))completeHandler;

@end
